//
//  PackageCell.m
//  UI_HLJ_Frame
//
//  Created by dllo on 15/6/30.
//  Copyright (c) 2015年 毕宏伟. All rights reserved.
//

#import "PackageCell.h"
#define WIDTH self.contentView.frame.size.width
#define HEIGHT self.contentView.frame.size.height
@implementation PackageCell
- (void)dealloc
{
    [_packageImageView release];
    [_backGroundView release];
    [_packageCollect release];
    [_packageMarketPrice release];
    [_packageName release];
    [_packageNowPrice release];
    [_packageTitle release];
    [super dealloc];
}

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // 背景
        self.backGroundView = [[UIView alloc] init];
        [self.contentView addSubview:self.backGroundView];
        [self.backGroundView release];
        
        // 图片
        self.packageImageView = [[UIImageView alloc] init];
        [self.backGroundView addSubview:self.packageImageView];
        [self.packageImageView release];
        // 标题
        self.packageTitle = [[UILabel alloc] init];
        [self.backGroundView addSubview:self.packageTitle];
        [self.packageTitle release];
        // 商家
        self.packageName = [[UILabel alloc] init];
        [self.backGroundView addSubview:self.packageName];
        [self.packageName release];
        // 现价
        self.packageNowPrice = [[UILabel alloc] init];
        [self.backGroundView addSubview:self.packageNowPrice];
        [self.packageNowPrice release];
        // 市场价
        self.packageMarketPrice = [[UILabel alloc] init];
        [self.backGroundView addSubview:self.packageMarketPrice];
        [self.packageMarketPrice release];
        // 收藏
        self.packageCollect = [[UILabel alloc] init];
        [self.backGroundView addSubview:self.packageCollect];
        [self.packageCollect release];
    }
    return self;
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.backGroundView.frame = CGRectMake(0, 0, WIDTH, HEIGHT);
    self.backGroundView.clipsToBounds = YES;
    
    self.packageImageView.frame = CGRectMake(5, 0, WIDTH - 10, HEIGHT / 1.3);
    
    self.packageTitle.frame = CGRectMake(10, HEIGHT / 1.28, WIDTH * 3 / 4, 25);
//        self.packageTitle.backgroundColor = [UIColor redColor];
    
    self.packageName.frame = CGRectMake(10, HEIGHT / 1.11, WIDTH / 2, 20);
//        self.packageName.backgroundColor = [UIColor orangeColor];
    
    self.packageNowPrice.frame = CGRectMake(10, HEIGHT / 1.9, 105, HEIGHT / 13);
    self.packageNowPrice.backgroundColor = [UIColor colorWithRed:1.000 green:0.404 blue:0.651 alpha:1.000];
    
    self.packageMarketPrice.frame = CGRectMake(10, HEIGHT / 1.67, 105, HEIGHT / 14);
    self.packageMarketPrice.backgroundColor = [UIColor colorWithRed:1.000 green:0.404 blue:0.651 alpha:1.000];
    
    self.packageCollect.frame = CGRectMake(WIDTH / 6 * 5, HEIGHT / 1.24, WIDTH / 6.5, 30);
//        self.packageCollect.backgroundColor = [UIColor yellowColor];
    
}

















- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
